<template>
  <div>
    <div class="httop">
      <div class="button">
        <span
          class="iconfont icon-zuoyoujiantou"
          @click="$router.push('/userinfo')"
        ></span>
        我的话题
      </div>
      <span class="iconfont icon-fenxiang"></span>
    </div>

    <div class="htli">
        <div class="htbox" v-for="(item, index) in hotlist" :key="index">
          <span class="hotname">{{ item.title }}</span>
          <p class="hottext">{{item.text[0]}}</p>
          <p class="hotnum">{{item.participateCount}}人在讨论</p>
          <div
            class="htimg"
            :style="'background-image: url(' + item.sharePicUrl + ')'"
          ></div>
        </div>
    </div>
  </div>
</template>

<script>
import { getHotTopic } from "../../api/base";
export default {
  data() {
    return {
      hotlist: [],
    };
  },
  methods: {
    getHotTopicFun() {
      getHotTopic().then((data) => {
        console.log(data.hot);
        this.hotlist = data.hot;
      });
    },
  },
  created() {
    this.getHotTopicFun();
  },
};
</script>

<style lang="less">
.httop {
  // width: 100%;
  height: 50px;
  position: relative;
  background-color: #d4473c;
  .icon-fenxiang {
    font-size: 23px;
    position: absolute;
    top: 12px;
    right: 20px;
    color: white;
  }
  .button {
    font-size: 18px;
    position: absolute;
    left: 12px;
    top: 12px;
    color: #fff;
  }
}
.htli {
  // margin-top: 10px;
    .htbox {
      border: 1px solid white;
      margin: 10px 10px;
      position: relative;
      height: 120px;
      border-bottom:1px solid #e6e6e6;
      .htimg {
        height: 80px;
        width: 120px;
        // border: 1px solid black;
        // position: absolute;
        background-size: cover;
        margin-left: 230px;
        margin-top: -60px;
        // float: right;
      }
      .hotname {
        width: 200px;
        // border: 1px solid black;
        font-size: 17px;
        font-weight: bold;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        position: absolute;
        // margin-left: 10px;
        // margin-top: 20px;
      }
      .hottext{
        // position: absolute;
        margin-top: 30px;
        width: 200px;
        height: 50px;
        line-height: 25px;
        overflow: hidden;
        text-overflow: ellipsis;
        color: #898989;
        // white-space: nowrap;
      }
      .hotnum{
        position: absolute;
        font-size: 10px;
        color: #9a9a9a;
        margin-top: 13px;
      }
    }
}
</style>